﻿import threading
import subprocess
import re


def rcv_data():
    while True:
        print('rcv start')
        rcv = subprocess.check_output(['cat', '/dev/ttyTHS1'])
        res = re.match( r'.*imx6qStart(.*)imx6qEnd.*', rcv, re.I|re.S)
        if (res):
            print('-----start---------')
            print(res[1])
            print('-----end---------')


if __name__ == '__main__':
    th=threading.Thread(target=rcv_data)
    th.start()

    
    